

public class BinaryTree {
    static class TreeNode{
        private  char val ;
        private TreeNode left ;
        private TreeNode right ;

        public TreeNode(char val) {
            this.val = val;
        }
    }
    public TreeNode root ;

    public void createTree() {
        TreeNode node1 = new TreeNode('A');
        TreeNode node2 = new TreeNode('B');
        TreeNode node3 = new TreeNode('C');
        TreeNode node4 = new TreeNode('D');
        TreeNode node5 = new TreeNode('E');
        TreeNode node6 = new TreeNode('F');
        TreeNode node7 = new TreeNode('G');
        TreeNode node8 = new TreeNode('H');
        node1.left = node2 ;
        node1.right = node3 ;
         node2.left = node4 ;
        node2.right = node5 ;
        node3.left = node6 ;
        node3.right = node7 ;
        node5.right = node8;
        this.root = node1 ;
    }
}
